package com.itheima.sentinel.service.impl;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.itheima.sentinel.exception.ExceptionUtils;
import com.itheima.sentinel.service.SentinelService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

@Service
public class SentinelServiceImpl implements SentinelService {
    @Override
    @SentinelResource(value = "hot",
            fallbackClass = ExceptionUtils.class,
            fallback = "testFallback",
            blockHandlerClass = ExceptionUtils.class,
            blockHandler = "testBlockHandler")
    public String hot(String name) {
        // int i = 10 / 0;
        System.out.println("----------" + name);
        return name;
    }
    
    static final Logger logger = LoggerFactory.getLogger(SentinelServiceImpl.class);
    
}
